package 对象;

public class giftFriend {
    private String name;
    private int age;
    private char xb;
    private String hobby;

    //空参
    public giftFriend(){}

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public char getXb() {
        return xb;
    }

    public void setXb(char xb) {
        this.xb = xb;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    //全参
    public giftFriend(String name, int age, char xb,String hobby){
        if ( age <= 0) {
            System.out.println("参数错误，年龄不能设置为小于0！");
        }else {
            this.age = age;
        }
        this.name = name;
        this.xb = xb;
        this.hobby = hobby;
    }
}
